package com.htl.线程;

import java.text.SimpleDateFormat;
import java.util.Date;

public class ClockTest {
    public static void main(String[] args) {
        Clock clock = new Clock();
        Thread thread = new Thread(clock);
        thread.start();
    }
}


class Clock implements Runnable{

    @Override
    public void run() {
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        while(true){
            Date d = new Date();
            System.out.println(sdf.format(d));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}